/**
 * 
 */
package edu.umd.clip.lm.ngram;

public class Sixgram extends Ngram {
	long w1;
	long w2;
	long w3;
	long w4;
	long w5;
	
	Sixgram(long[] context, long future) {
		this(context[0], context[1], context[2], context[4], context[5], future);
	}
	
	public Sixgram(long w1, long w2, long w3, long w4, long w5, long future) {
		super(future);
		this.w1 = w1;
		this.w2 = w2;
		this.w3 = w3;
		this.w4 = w4;
		this.w5 = w5;
	}

	/* (non-Javadoc)
	 * @see edu.umd.clip.lm.tools.PruneTrainingData.Ngram#getContext()
	 */
	@Override
	public long[] getContext() {
		return new long[] {w1, w2, w3, w4, w5};
	}

	/* (non-Javadoc)
	 * @see edu.umd.clip.lm.tools.PruneTrainingData.Ngram#getOrder()
	 */
	@Override
	public int getOrder() {
		return 5;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + (int) (w1 ^ (w1 >>> 32));
		result = prime * result + (int) (w2 ^ (w2 >>> 32));
		result = prime * result + (int) (w3 ^ (w3 >>> 32));
		result = prime * result + (int) (w4 ^ (w4 >>> 32));
		result = prime * result + (int) (w5 ^ (w5 >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (!(obj instanceof Sixgram))
			return false;
		Sixgram other = (Sixgram) obj;
		if (w1 != other.w1)
			return false;
		if (w2 != other.w2)
			return false;
		if (w3 != other.w3)
			return false;
		if (w4 != other.w4)
			return false;
		if (w5 != other.w5)
			return false;
		return true;
	}

	/* (non-Javadoc)
	 * @see edu.umd.clip.lm.ngram.Ngram#getLowerOrderNgram()
	 */
	@Override
	public Ngram getLowerOrderNgram() {
		return new Fivegram(w1, w2, w3, w4, future);
	}
	
	
}